﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WhitespaceFilterDemo.aspx.cs"
	Inherits="ASPNETPerformance._04_PageFilter.WhitespaceFilterDemo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Whitespace Filter Demo</title>
	<script type="text/javascript">
		function DisplayMessage(msg) {
			// Show a message in a modal dlg box
			alert('The website has the following thing to say to you: ' + msg);
		}
	</script>
	<link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<h1>
			<a href="Default.aspx">Home</a> :: Whitespace Filter Demo</h1>
		<p>
			This demo illustrates the <code>WhitespaceFilter</code> HTTP Filter in action. First,
			view this page's content through Visual Studio and note the whitespace: carriage
			returns, tabs, and so on. Then, when viewing this page through a browser, view the
			page source. The whitespace has been eliminated thanks to the <code>WhitespaceFilter
			</code>HTTP Filter.
		</p>
		<p>
			Here is a test of words each on their own line.
		</p>
		<p>
			<a href="http://www.4guysfromrolla.com/ScottMitchell.shtml">Scott Mitchell</a>,
			author of seven ASP/ASP.NET books and founder of <a href="http://www.4guysfromrolla.com/">
				4GuysFromRolla.com</a>, has been working with Microsoft Web technologies since
			1998. Scott works as an independent consultant, trainer, and writer. His latest
			book is <i><a href="http://www.amazon.com/exec/obidos/ASIN/0672329972/4guysfromrollaco">
				Sams Teach Yourself ASP.NET 3.5 in 24 Hours</a></i>. He can be reached at mitchell@4GuysFromRolla.com
			or via his blog, <a href="http://ScottOnWriting.NET">http://ScottOnWriting.NET</a>.
		</p>
		<p>
			Notice that the whitespace stripping filter strips out the carriage return in the
			JavaScript code, as well, thereby "commenting out" the <code>alert</code>. Consequently,
			the call to <code>DisplayMessage</code> doesn't do anything! Implementing a "proper"
			whitespace removing filter is not trivial....<br />
			<input type="button" value="Click Me, IF YOU DARE!" onclick="DisplayMessage('You clicked me, you really did it!');" />
		</p>
	</div>
	</form>
</body>
</html>
